package com.gitee.shigen.common.msg;

import lombok.Data;

/**
 * @author shigenfu
 */
@Data
public class Result<T> {

    /**
     * 业务码
     */
    private Integer code = 200;
    /**
     * 信息描述
     */
    private String  msg;
    /**
     * 返回参数
     */
    private T       data;

    public Result() {
    }

    public Result(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> Result<T> success(T data) {
        return new Result<T>(200, "", data);
    }

    public static <T> Result<T> failed(String message) {
        return new Result<T>(500, message, null);
    }

}
